﻿namespace Smart.ERP
{
    using DevExpress.XtraEditors;
    using Smart.Common;
    using Smart.Data.Helper;
    using Smart.Utils.Lib;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Windows.Forms;

    public class EMPLOYEE
    {
        private bool m_Active;
        private string m_Address;
        private decimal m_Advance;
        private decimal m_AdvanceOther;
        private string m_Alias;
        private decimal m_BasicSalary;
        private System.DateTime m_Birthday;
        private string m_Branch_ID;
        private string m_City_ID;
        private decimal m_Commission;
        private string m_Country_ID;
        private string m_CreatedBy;
        private System.DateTime m_CreatedDate;
        private string m_Department_ID;
        private string m_Description;
        private decimal m_Discount;
        private string m_District_ID;
        private string m_Email;
        private string m_Employee_ID;
        private string m_Employee_Name;
        private int m_EmployeeType;
        private string m_Fax;
        private string m_FirtName;
        private string m_H_Tel;
        private bool m_IsPublic;
        private string m_JobTitle_ID;
        private string m_LastName;
        private string m_Manager_ID;
        private int m_Married;
        private string m_Mobile;
        private string m_ModifiedBy;
        private System.DateTime m_ModifiedDate;
        private string m_O_Tel;
        private string m_OwnerID;
        private string m_PersonalTax_ID;
        private string m_Position_ID;
        private decimal m_ProfitRate;
        private bool m_Sex;
        private long m_Sorted;
        private string m_Team_ID;

        public EMPLOYEE()
        {
            this.m_Employee_ID = "";
            this.m_FirtName = "";
            this.m_LastName = "";
            this.m_Employee_Name = "";
            this.m_Alias = "";
            this.m_Sex = true;
            this.m_Address = "";
            this.m_Country_ID = "";
            this.m_H_Tel = "";
            this.m_O_Tel = "";
            this.m_Mobile = "";
            this.m_Fax = "";
            this.m_Email = "";
            this.m_Birthday = System.DateTime.Now;
            this.m_Married = 0;
            this.m_Position_ID = "";
            this.m_JobTitle_ID = "";
            this.m_Branch_ID = "";
            this.m_Department_ID = "";
            this.m_Team_ID = "";
            this.m_PersonalTax_ID = "";
            this.m_City_ID = "";
            this.m_District_ID = "";
            this.m_Manager_ID = "";
            this.m_EmployeeType = 0;
            this.m_BasicSalary = 0M;
            this.m_Advance = 0M;
            this.m_AdvanceOther = 0M;
            this.m_Commission = 0M;
            this.m_Discount = 0M;
            this.m_ProfitRate = 0M;
            this.m_IsPublic = true;
            this.m_CreatedBy = "";
            this.m_CreatedDate = System.DateTime.Now;
            this.m_ModifiedBy = "";
            this.m_ModifiedDate = System.DateTime.Now;
            this.m_OwnerID = "";
            this.m_Description = "";
            this.m_Sorted = 0L;
            this.m_Active = true;
        }

        public EMPLOYEE(string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            this.m_Employee_ID = Employee_ID;
            this.m_FirtName = FirtName;
            this.m_LastName = LastName;
            this.m_Employee_Name = Employee_Name;
            this.m_Alias = Alias;
            this.m_Sex = Sex;
            this.m_Address = Address;
            this.m_Country_ID = Country_ID;
            this.m_H_Tel = H_Tel;
            this.m_O_Tel = O_Tel;
            this.m_Mobile = Mobile;
            this.m_Fax = Fax;
            this.m_Email = Email;
            this.m_Birthday = Birthday;
            this.m_Married = Married;
            this.m_Position_ID = Position_ID;
            this.m_JobTitle_ID = JobTitle_ID;
            this.m_Branch_ID = Branch_ID;
            this.m_Department_ID = Department_ID;
            this.m_Team_ID = Team_ID;
            this.m_PersonalTax_ID = PersonalTax_ID;
            this.m_City_ID = City_ID;
            this.m_District_ID = District_ID;
            this.m_Manager_ID = Manager_ID;
            this.m_EmployeeType = EmployeeType;
            this.m_BasicSalary = BasicSalary;
            this.m_Advance = Advance;
            this.m_AdvanceOther = AdvanceOther;
            this.m_Commission = Commission;
            this.m_Discount = Discount;
            this.m_ProfitRate = ProfitRate;
            this.m_IsPublic = IsPublic;
            this.m_CreatedBy = CreatedBy;
            this.m_CreatedDate = CreatedDate;
            this.m_ModifiedBy = ModifiedBy;
            this.m_ModifiedDate = ModifiedDate;
            this.m_OwnerID = OwnerID;
            this.m_Description = Description;
            this.m_Sorted = Sorted;
            this.m_Active = Active;
        }

        public void AddCombo(System.Windows.Forms.ComboBox combo)
        {
            this.AddCombo(combo, this.LookUp());
        }

        public void AddCombo(System.Windows.Forms.ComboBox combo, DataTable dt)
        {
            MyLib.TableToComboBox(combo, dt, "ID", "Name");
        }

        public void AddComboAll(System.Windows.Forms.ComboBox combo)
        {
            this.AddComboAll(combo, "(Tất cả)");
        }

        public void AddComboAll(System.Windows.Forms.ComboBox combo, string text)
        {
            DataTable table = new DataTable();
            table = this.LookUp();
            DataRow row = table.NewRow();
            row["ID"] = "All";
            row["Name"] = text;
            table.Rows.InsertAt(row, 0);
            MyLib.TableToComboBox(combo, table, "ID", "Name");
        }

        public void AddComboDefault(System.Windows.Forms.ComboBox combo)
        {
            this.AddComboAll(combo, "(Mặc định)");
        }

        public int Count()
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if (helper.Open() != "OK")
            {
                return 0;
            }
            int num = this.Count(helper.Connection);
            helper.Close();
            return num;
        }

        public int Count(SqlConnection myConnection)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteScalar(myConnection, "EMPLOYEE_Count", 0);
        }

        public int Count(SqlTransaction myTransaction)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteScalar(myTransaction, "EMPLOYEE_Count", 0);
        }

        public string CreateKey()
        {
            return this.CreateKey("");
        }

        public string CreateKey(SqlTransaction myTransaction)
        {
            return SqlHelper.GenCode(myTransaction, "");
        }

        public string CreateKey(string key)
        {
            return SqlHelper.GenCode(key);
        }

        public string CreateKey(SqlTransaction myTransaction, string key)
        {
            return SqlHelper.GenCode(myTransaction, key);
        }

        public bool Delete()
        {
            return this.Delete(this.m_Employee_ID);
        }

        public bool Delete(SqlConnection myConnection)
        {
            return this.Delete(myConnection, this.m_Employee_ID);
        }

        public bool Delete(SqlTransaction myTransaction)
        {
            return this.Delete(myTransaction, this.m_Employee_ID);
        }

        public bool Delete(string Employee_ID)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if ((helper.Open() == "OK") && this.Delete(helper.Connection, Employee_ID))
            {
                helper.Close();
                return true;
            }
            return false;
        }

        public bool Delete(SqlConnection myConnection, string Employee_ID)
        {
            string[] myParams = new string[] { "@Employee_ID" };
            object[] myValues = new object[] { Employee_ID };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myConnection, "EMPLOYEE_Delete", myParams, myValues) == "OK");
        }

        public bool Delete(SqlTransaction myTransaction, string Employee_ID)
        {
            string[] myParams = new string[] { "@Employee_ID" };
            object[] myValues = new object[] { Employee_ID };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myTransaction, "EMPLOYEE_Delete", myParams, myValues) == "OK");
        }

        private void DispError(object sender, SqlHelperException e)
        {
            XtraMessageBox.Show(e.Message, "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }

        public bool Exist()
        {
            return this.Exist(this.m_Employee_ID);
        }

        public bool Exist(SqlTransaction myTransaction)
        {
            return this.Exist(myTransaction, this.m_Employee_ID);
        }

        public bool Exist(string Employee_ID)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if ((helper.Open() == "OK") && this.Exist(helper.Connection, Employee_ID))
            {
                helper.Close();
                return true;
            }
            return false;
        }

        public bool Exist(SqlConnection myConnection, string Employee_ID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@Employee_ID" };
            object[] myValues = new object[] { Employee_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "EMPLOYEE_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                return hasRows;
            }
            helper.Close();
            if (MyParamaters.IsShowWarning)
            {
                XtraMessageBox.Show(helper.Result, "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return hasRows;
        }

        public bool Exist(SqlTransaction myTransaction, string Employee_ID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@Employee_ID" };
            object[] myValues = new object[] { Employee_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "EMPLOYEE_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                return hasRows;
            }
            helper.RollBack(myTransaction);
            if (MyParamaters.IsShowWarning)
            {
                XtraMessageBox.Show(helper.Result, "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return hasRows;
        }

        public bool Get()
        {
            return this.Get(this.m_Employee_ID);
        }

        public bool Get(SqlConnection myConnection)
        {
            return this.Get(myConnection, this.m_Employee_ID);
        }

        public bool Get(SqlTransaction myTransaction)
        {
            return this.Get(myTransaction, this.m_Employee_ID);
        }

        public bool Get(string Employee_ID)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if ((helper.Open() == "OK") && this.Get(helper.Connection, Employee_ID))
            {
                helper.Close();
                return true;
            }
            return false;
        }

        public bool Get(SqlConnection myConnection, string Employee_ID)
        {
            bool flag = false;
            string[] myParams = new string[] { "@Employee_ID" };
            object[] myValues = new object[] { Employee_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "EMPLOYEE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_Employee_ID = Convert.ToString(reader["Employee_ID"]);
                    this.m_FirtName = Convert.ToString(reader["FirtName"]);
                    this.m_LastName = Convert.ToString(reader["LastName"]);
                    this.m_Employee_Name = Convert.ToString(reader["Employee_Name"]);
                    this.m_Alias = Convert.ToString(reader["Alias"]);
                    this.m_Sex = Convert.ToBoolean(reader["Sex"]);
                    this.m_Address = Convert.ToString(reader["Address"]);
                    this.m_Country_ID = Convert.ToString(reader["Country_ID"]);
                    this.m_H_Tel = Convert.ToString(reader["H_Tel"]);
                    this.m_O_Tel = Convert.ToString(reader["O_Tel"]);
                    this.m_Mobile = Convert.ToString(reader["Mobile"]);
                    this.m_Fax = Convert.ToString(reader["Fax"]);
                    this.m_Email = Convert.ToString(reader["Email"]);
                    this.m_Birthday = Convert.ToDateTime(reader["Birthday"]);
                    this.m_Married = Convert.ToInt32(reader["Married"]);
                    this.m_Position_ID = Convert.ToString(reader["Position_ID"]);
                    this.m_JobTitle_ID = Convert.ToString(reader["JobTitle_ID"]);
                    this.m_Branch_ID = Convert.ToString(reader["Branch_ID"]);
                    this.m_Department_ID = Convert.ToString(reader["Department_ID"]);
                    this.m_Team_ID = Convert.ToString(reader["Team_ID"]);
                    this.m_PersonalTax_ID = Convert.ToString(reader["PersonalTax_ID"]);
                    this.m_City_ID = Convert.ToString(reader["City_ID"]);
                    this.m_District_ID = Convert.ToString(reader["District_ID"]);
                    this.m_Manager_ID = Convert.ToString(reader["Manager_ID"]);
                    this.m_EmployeeType = Convert.ToInt32(reader["EmployeeType"]);
                    this.m_Active = Convert.ToBoolean(reader["Active"]);
                    flag = true;
                }
                reader.Close();
                reader = null;
                return flag;
            }
            helper.Close();
            if (MyParamaters.IsShowWarning)
            {
                XtraMessageBox.Show(helper.Result, "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return flag;
        }

        public bool Get(SqlTransaction myTransaction, string Employee_ID)
        {
            bool flag = false;
            string[] myParams = new string[] { "@Employee_ID" };
            object[] myValues = new object[] { Employee_ID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "EMPLOYEE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_Employee_ID = Convert.ToString(reader["Employee_ID"]);
                    this.m_FirtName = Convert.ToString(reader["FirtName"]);
                    this.m_LastName = Convert.ToString(reader["LastName"]);
                    this.m_Employee_Name = Convert.ToString(reader["Employee_Name"]);
                    this.m_Alias = Convert.ToString(reader["Alias"]);
                    this.m_Sex = Convert.ToBoolean(reader["Sex"]);
                    this.m_Address = Convert.ToString(reader["Address"]);
                    this.m_Country_ID = Convert.ToString(reader["Country_ID"]);
                    this.m_H_Tel = Convert.ToString(reader["H_Tel"]);
                    this.m_O_Tel = Convert.ToString(reader["O_Tel"]);
                    this.m_Mobile = Convert.ToString(reader["Mobile"]);
                    this.m_Fax = Convert.ToString(reader["Fax"]);
                    this.m_Email = Convert.ToString(reader["Email"]);
                    this.m_Birthday = Convert.ToDateTime(reader["Birthday"]);
                    this.m_Married = Convert.ToInt32(reader["Married"]);
                    this.m_Position_ID = Convert.ToString(reader["Position_ID"]);
                    this.m_JobTitle_ID = Convert.ToString(reader["JobTitle_ID"]);
                    this.m_Branch_ID = Convert.ToString(reader["Branch_ID"]);
                    this.m_Department_ID = Convert.ToString(reader["Department_ID"]);
                    this.m_Team_ID = Convert.ToString(reader["Team_ID"]);
                    this.m_PersonalTax_ID = Convert.ToString(reader["PersonalTax_ID"]);
                    this.m_City_ID = Convert.ToString(reader["City_ID"]);
                    this.m_District_ID = Convert.ToString(reader["District_ID"]);
                    this.m_Manager_ID = Convert.ToString(reader["Manager_ID"]);
                    this.m_EmployeeType = Convert.ToInt32(reader["EmployeeType"]);
                    this.m_BasicSalary = Convert.ToDecimal(reader["BasicSalary"]);
                    this.m_Advance = Convert.ToDecimal(reader["Advance"]);
                    this.m_AdvanceOther = Convert.ToDecimal(reader["AdvanceOther"]);
                    this.m_Commission = Convert.ToDecimal(reader["Commission"]);
                    this.m_Discount = Convert.ToDecimal(reader["Discount"]);
                    this.m_ProfitRate = Convert.ToDecimal(reader["ProfitRate"]);
                    this.m_IsPublic = Convert.ToBoolean(reader["IsPublic"]);
                    this.m_CreatedBy = Convert.ToString(reader["CreatedBy"]);
                    this.m_CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
                    this.m_ModifiedBy = Convert.ToString(reader["ModifiedBy"]);
                    this.m_ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
                    this.m_OwnerID = Convert.ToString(reader["OwnerID"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    this.m_Sorted = Convert.ToInt64(reader["Sorted"]);
                    this.m_Active = Convert.ToBoolean(reader["Active"]);
                    flag = true;
                }
                reader.Close();
                reader = null;
                return flag;
            }
            helper.RollBack(myTransaction);
            if (MyParamaters.IsShowWarning)
            {
                XtraMessageBox.Show(helper.Result, "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return flag;
        }

        public DataTable GetList()
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteDataTable("EMPLOYEE_GetList");
        }

        public DataTable GetList(SqlConnection myConnection)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteDataTable(myConnection, "EMPLOYEE_GetList");
        }

        public DataTable GetList(SqlTransaction myTransaction)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteDataTable(myTransaction, "EMPLOYEE_GetList");
        }

        public bool Insert()
        {
            return this.Insert(this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_CreatedBy, this.m_CreatedDate, this.m_ModifiedBy, this.m_ModifiedDate, this.m_OwnerID, this.m_Description, this.m_Sorted, this.m_Active);
        }

        public bool Insert(SqlConnection myConnection)
        {
            return this.Insert(myConnection, this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_CreatedBy, this.m_CreatedDate, this.m_ModifiedBy, this.m_ModifiedDate, this.m_OwnerID, this.m_Description, this.m_Sorted, this.m_Active);
        }

        public bool Insert(SqlTransaction myTransaction)
        {
            return this.Insert(myTransaction, this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_CreatedBy, this.m_CreatedDate, this.m_ModifiedBy, this.m_ModifiedDate, this.m_OwnerID, this.m_Description, this.m_Sorted, this.m_Active);
        }

        public bool Insert(string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if ((helper.Open() == "OK") && this.Insert(helper.Connection, Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, CreatedBy, CreatedDate, ModifiedBy, ModifiedDate, OwnerID, Description, Sorted, Active))
            {
                helper.Close();
                return true;
            }
            return false;
        }

        public bool Insert(SqlConnection myConnection, string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            string[] myParams = new string[] { 
                "@Employee_ID", "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@Country_ID", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@Position_ID", 
                "@JobTitle_ID", "@Branch_ID", "@Department_ID", "@Team_ID", "@PersonalTax_ID", "@City_ID", "@District_ID", "@Manager_ID", "@EmployeeType", "@BasicSalary", "@Advance", "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@IsPublic", 
                "@CreatedBy", "@CreatedDate", "@ModifiedBy", "@ModifiedDate", "@OwnerID", "@Description", "@Sorted", "@Active"
             };
            object[] myValues = new object[] { 
                Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, 
                JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, 
                CreatedBy, CreatedDate, ModifiedBy, ModifiedDate, OwnerID, Description, Sorted, Active
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myConnection, "EMPLOYEE_Insert", myParams, myValues) == "OK");
        }

        public bool Insert(SqlTransaction myTransaction, string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            string[] myParams = new string[] { 
                "@Employee_ID", "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@Country_ID", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@Position_ID", 
                "@JobTitle_ID", "@Branch_ID", "@Department_ID", "@Team_ID", "@PersonalTax_ID", "@City_ID", "@District_ID", "@Manager_ID", "@EmployeeType", "@BasicSalary", "@Advance", "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@IsPublic", 
                "@CreatedBy", "@CreatedDate", "@ModifiedBy", "@ModifiedDate", "@OwnerID", "@Description", "@Sorted", "@Active"
             };
            object[] myValues = new object[] { 
                Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, 
                JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, 
                CreatedBy, CreatedDate, ModifiedBy, ModifiedDate, OwnerID, Description, Sorted, Active
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myTransaction, "EMPLOYEE_Insert", myParams, myValues) == "OK");
        }

        public DataTable LookUp()
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteDataTable("EMPLOYEE_LookUp");
        }

        public string NewID()
        {
            return this.NewID("NV");
        }

        public string NewID(string key)
        {
            return SqlHelper.GenCode("EMPLOYEE", "Employee_ID", key);
        }

        public string NewID(SqlTransaction myTransaction, string key)
        {
            return SqlHelper.GenCode(myTransaction, "EMPLOYEE", "Employee_ID", key);
        }

        public DataTable Search(string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, string Description)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if (helper.Open() != "OK")
            {
                return null;
            }
            return this.Search(helper.Connection, FirtName, LastName, Employee_Name, Alias, Sex, Address, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, Description);
        }

        public DataTable Search(SqlConnection myConnection, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, string Description)
        {
            string[] myParams = new string[] { 
                "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@EmployeeType", "@BasicSalary", "@Advance", 
                "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@Description"
             };
            object[] myValues = new object[] { 
                "%" + FirtName + "%", "%" + LastName + "%", "%" + Employee_Name + "%", "%" + Alias + "%", "%" + Sex + "%", "%" + Address + "%", "%" + H_Tel + "%", "%" + O_Tel + "%", "%" + Mobile + "%", "%" + Fax + "%", "%" + Email + "%", "%" + Birthday + "%", "%" + Married + "%", "%" + EmployeeType + "%", "%" + BasicSalary + "%", "%" + Advance + "%", 
                "%" + AdvanceOther + "%", "%" + Commission + "%", "%" + Discount + "%", "%" + ProfitRate + "%", "%" + Description + "%"
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteDataTable(myConnection, "EMPLOYEE_Search", myParams, myValues);
        }

        public DataTable Search(SqlTransaction myTransaction, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, string Description)
        {
            string[] myParams = new string[] { 
                "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@EmployeeType", "@BasicSalary", "@Advance", 
                "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@Description"
             };
            object[] myValues = new object[] { 
                "%" + FirtName + "%", "%" + LastName + "%", "%" + Employee_Name + "%", "%" + Alias + "%", "%" + Sex + "%", "%" + Address + "%", "%" + H_Tel + "%", "%" + O_Tel + "%", "%" + Mobile + "%", "%" + Fax + "%", "%" + Email + "%", "%" + Birthday + "%", "%" + Married + "%", "%" + EmployeeType + "%", "%" + BasicSalary + "%", "%" + Advance + "%", 
                "%" + AdvanceOther + "%", "%" + Commission + "%", "%" + Discount + "%", "%" + ProfitRate + "%", "%" + Description + "%"
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return helper.ExecuteDataTable(myTransaction, "EMPLOYEE_Search", myParams, myValues);
        }

        public void SetData(string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            this.m_Employee_ID = Employee_ID;
            this.m_FirtName = FirtName;
            this.m_LastName = LastName;
            this.m_Employee_Name = Employee_Name;
            this.m_Alias = Alias;
            this.m_Sex = Sex;
            this.m_Address = Address;
            this.m_Country_ID = Country_ID;
            this.m_H_Tel = H_Tel;
            this.m_O_Tel = O_Tel;
            this.m_Mobile = Mobile;
            this.m_Fax = Fax;
            this.m_Email = Email;
            this.m_Birthday = Birthday;
            this.m_Married = Married;
            this.m_Position_ID = Position_ID;
            this.m_JobTitle_ID = JobTitle_ID;
            this.m_Branch_ID = Branch_ID;
            this.m_Department_ID = Department_ID;
            this.m_Team_ID = Team_ID;
            this.m_PersonalTax_ID = PersonalTax_ID;
            this.m_City_ID = City_ID;
            this.m_District_ID = District_ID;
            this.m_Manager_ID = Manager_ID;
            this.m_EmployeeType = EmployeeType;
            this.m_BasicSalary = BasicSalary;
            this.m_Advance = Advance;
            this.m_AdvanceOther = AdvanceOther;
            this.m_Commission = Commission;
            this.m_Discount = Discount;
            this.m_ProfitRate = ProfitRate;
            this.m_IsPublic = IsPublic;
            this.m_CreatedBy = CreatedBy;
            this.m_CreatedDate = CreatedDate;
            this.m_ModifiedBy = ModifiedBy;
            this.m_ModifiedDate = ModifiedDate;
            this.m_OwnerID = OwnerID;
            this.m_Description = Description;
            this.m_Sorted = Sorted;
            this.m_Active = Active;
        }

        public bool Update()
        {
            return this.Update(this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_CreatedBy, this.m_CreatedDate, this.m_ModifiedBy, this.m_ModifiedDate, this.m_OwnerID, this.m_Description, this.m_Sorted, this.m_Active);
        }

        public bool Update(SqlConnection myConnection)
        {
            return this.Update(this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_CreatedBy, this.m_CreatedDate, this.m_ModifiedBy, this.m_ModifiedDate, this.m_OwnerID, this.m_Description, this.m_Sorted, this.m_Active);
        }

        public bool Update(SqlTransaction myTransaction)
        {
            return this.Update(myTransaction, this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_CreatedBy, this.m_CreatedDate, this.m_ModifiedBy, this.m_ModifiedDate, this.m_OwnerID, this.m_Description, this.m_Sorted, this.m_Active);
        }

        public bool Update(string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if ((helper.Open() == "OK") && this.Update(helper.Connection, Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, CreatedBy, CreatedDate, ModifiedBy, ModifiedDate, OwnerID, Description, Sorted, Active))
            {
                helper.Close();
                return true;
            }
            return false;
        }

        public bool Update(SqlConnection myConnection, string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            string[] myParams = new string[] { 
                "@Employee_ID", "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@Country_ID", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@Position_ID", 
                "@JobTitle_ID", "@Branch_ID", "@Department_ID", "@Team_ID", "@PersonalTax_ID", "@City_ID", "@District_ID", "@Manager_ID", "@EmployeeType", "@BasicSalary", "@Advance", "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@IsPublic", 
                "@CreatedBy", "@CreatedDate", "@ModifiedBy", "@ModifiedDate", "@OwnerID", "@Description", "@Sorted", "@Active"
             };
            object[] myValues = new object[] { 
                Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, 
                JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, 
                CreatedBy, CreatedDate, ModifiedBy, ModifiedDate, OwnerID, Description, Sorted, Active
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myConnection, "EMPLOYEE_Update", myParams, myValues) == "OK");
        }

        public bool Update(SqlTransaction myTransaction, string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string CreatedBy, System.DateTime CreatedDate, string ModifiedBy, System.DateTime ModifiedDate, string OwnerID, string Description, long Sorted, bool Active)
        {
            string[] myParams = new string[] { 
                "@Employee_ID", "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@Country_ID", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@Position_ID", 
                "@JobTitle_ID", "@Branch_ID", "@Department_ID", "@Team_ID", "@PersonalTax_ID", "@City_ID", "@District_ID", "@Manager_ID", "@EmployeeType", "@BasicSalary", "@Advance", "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@IsPublic", 
                "@CreatedBy", "@CreatedDate", "@ModifiedBy", "@ModifiedDate", "@OwnerID", "@Description", "@Sorted", "@Active"
             };
            object[] myValues = new object[] { 
                Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, 
                JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, 
                CreatedBy, CreatedDate, ModifiedBy, ModifiedDate, OwnerID, Description, Sorted, Active
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myTransaction, "EMPLOYEE_Update", myParams, myValues) == "OK");
        }

        public bool UpdateByID()
        {
            return this.UpdateByID(this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_ModifiedBy, this.m_ModifiedDate, this.m_Description, this.m_Active);
        }

        public bool UpdateByID(SqlConnection myConnection)
        {
            return this.UpdateByID(myConnection, this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_ModifiedBy, this.m_ModifiedDate, this.m_Description, this.m_Active);
        }

        public bool UpdateByID(SqlTransaction myTransaction)
        {
            return this.UpdateByID(myTransaction, this.m_Employee_ID, this.m_FirtName, this.m_LastName, this.m_Employee_Name, this.m_Alias, this.m_Sex, this.m_Address, this.m_Country_ID, this.m_H_Tel, this.m_O_Tel, this.m_Mobile, this.m_Fax, this.m_Email, this.m_Birthday, this.m_Married, this.m_Position_ID, this.m_JobTitle_ID, this.m_Branch_ID, this.m_Department_ID, this.m_Team_ID, this.m_PersonalTax_ID, this.m_City_ID, this.m_District_ID, this.m_Manager_ID, this.m_EmployeeType, this.m_BasicSalary, this.m_Advance, this.m_AdvanceOther, this.m_Commission, this.m_Discount, this.m_ProfitRate, this.m_IsPublic, this.m_ModifiedBy, this.m_ModifiedDate, this.m_Description, this.m_Active);
        }

        public bool UpdateByID(string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string ModifiedBy, System.DateTime ModifiedDate, string Description, bool Active)
        {
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            if ((helper.Open() == "OK") && this.UpdateByID(helper.Connection, Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, ModifiedBy, ModifiedDate, Description, Active))
            {
                helper.Close();
                return true;
            }
            return false;
        }

        public bool UpdateByID(SqlConnection myConnection, string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string ModifiedBy, System.DateTime ModifiedDate, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Employee_ID", "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@Country_ID", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@Position_ID", 
                "@JobTitle_ID", "@Branch_ID", "@Department_ID", "@Team_ID", "@PersonalTax_ID", "@City_ID", "@District_ID", "@Manager_ID", "@EmployeeType", "@BasicSalary", "@Advance", "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@IsPublic", 
                "@ModifiedBy", "@ModifiedDate", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, 
                JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, 
                ModifiedBy, ModifiedDate, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myConnection, "EMPLOYEE_UpdateByID", myParams, myValues) == "OK");
        }

        public bool UpdateByID(SqlTransaction myTransaction, string Employee_ID, string FirtName, string LastName, string Employee_Name, string Alias, bool Sex, string Address, string Country_ID, string H_Tel, string O_Tel, string Mobile, string Fax, string Email, System.DateTime Birthday, int Married, string Position_ID, string JobTitle_ID, string Branch_ID, string Department_ID, string Team_ID, string PersonalTax_ID, string City_ID, string District_ID, string Manager_ID, int EmployeeType, decimal BasicSalary, decimal Advance, decimal AdvanceOther, decimal Commission, decimal Discount, decimal ProfitRate, bool IsPublic, string ModifiedBy, System.DateTime ModifiedDate, string Description, bool Active)
        {
            string[] myParams = new string[] { 
                "@Employee_ID", "@FirtName", "@LastName", "@Employee_Name", "@Alias", "@Sex", "@Address", "@Country_ID", "@H_Tel", "@O_Tel", "@Mobile", "@Fax", "@Email", "@Birthday", "@Married", "@Position_ID", 
                "@JobTitle_ID", "@Branch_ID", "@Department_ID", "@Team_ID", "@PersonalTax_ID", "@City_ID", "@District_ID", "@Manager_ID", "@EmployeeType", "@BasicSalary", "@Advance", "@AdvanceOther", "@Commission", "@Discount", "@ProfitRate", "@IsPublic", 
                "@ModifiedBy", "@ModifiedDate", "@Description", "@Active"
             };
            object[] myValues = new object[] { 
                Employee_ID, FirtName, LastName, Employee_Name, Alias, Sex, Address, Country_ID, H_Tel, O_Tel, Mobile, Fax, Email, Birthday, Married, Position_ID, 
                JobTitle_ID, Branch_ID, Department_ID, Team_ID, PersonalTax_ID, City_ID, District_ID, Manager_ID, EmployeeType, BasicSalary, Advance, AdvanceOther, Commission, Discount, ProfitRate, IsPublic, 
                ModifiedBy, ModifiedDate, Description, Active
             };
            SqlHelper helper = new SqlHelper();
            helper.Error += new SqlHelper.ErrorEventHander(this.DispError);
            return (helper.ExecuteNonQuery(myTransaction, "EMPLOYEE_UpdateByID", myParams, myValues) == "OK");
        }

        [DisplayName("Active"), Category("Column")]
        public bool Active
        {
            get
            {
                return this.m_Active;
            }
            set
            {
                this.m_Active = value;
            }
        }

        [Category("Column"), DisplayName("Address")]
        public string Address
        {
            get
            {
                return this.m_Address;
            }
            set
            {
                this.m_Address = value;
            }
        }

        [Category("Column"), DisplayName("Advance")]
        public decimal Advance
        {
            get
            {
                return this.m_Advance;
            }
            set
            {
                this.m_Advance = value;
            }
        }

        [DisplayName("AdvanceOther"), Category("Column")]
        public decimal AdvanceOther
        {
            get
            {
                return this.m_AdvanceOther;
            }
            set
            {
                this.m_AdvanceOther = value;
            }
        }

        [DisplayName("Alias"), Category("Column")]
        public string Alias
        {
            get
            {
                return this.m_Alias;
            }
            set
            {
                this.m_Alias = value;
            }
        }

        public string AssemblyVersion
        {
            get
            {
                return "2.5.0.0";
            }
        }

        [DisplayName("BasicSalary"), Category("Column")]
        public decimal BasicSalary
        {
            get
            {
                return this.m_BasicSalary;
            }
            set
            {
                this.m_BasicSalary = value;
            }
        }

        [Category("Column"), DisplayName("Birthday")]
        public System.DateTime Birthday
        {
            get
            {
                return this.m_Birthday;
            }
            set
            {
                this.m_Birthday = value;
            }
        }

        [DisplayName("Branch_ID"), Category("Column")]
        public string Branch_ID
        {
            get
            {
                return this.m_Branch_ID;
            }
            set
            {
                this.m_Branch_ID = value;
            }
        }

        [Category("Column"), DisplayName("City_ID")]
        public string City_ID
        {
            get
            {
                return this.m_City_ID;
            }
            set
            {
                this.m_City_ID = value;
            }
        }

        [DisplayName("Commission"), Category("Column")]
        public decimal Commission
        {
            get
            {
                return this.m_Commission;
            }
            set
            {
                this.m_Commission = value;
            }
        }

        public string Copyright
        {
            get
            {
                return "C\x00f4ng Ty Phần Mềm Ho\x00e0n Hảo";
            }
        }

        [Category("Column"), DisplayName("Country_ID")]
        public string Country_ID
        {
            get
            {
                return this.m_Country_ID;
            }
            set
            {
                this.m_Country_ID = value;
            }
        }

        [Category("Column"), DisplayName("CreatedBy")]
        public string CreatedBy
        {
            get
            {
                return this.m_CreatedBy;
            }
            set
            {
                this.m_CreatedBy = value;
            }
        }

        [DisplayName("CreatedDate"), Category("Column")]
        public System.DateTime CreatedDate
        {
            get
            {
                return this.m_CreatedDate;
            }
            set
            {
                this.m_CreatedDate = value;
            }
        }

        [Category("Column"), DisplayName("Department_ID")]
        public string Department_ID
        {
            get
            {
                return this.m_Department_ID;
            }
            set
            {
                this.m_Department_ID = value;
            }
        }

        [Category("Column"), DisplayName("Description")]
        public string Description
        {
            get
            {
                return this.m_Description;
            }
            set
            {
                this.m_Description = value;
            }
        }

        [Category("Column"), DisplayName("Discount")]
        public decimal Discount
        {
            get
            {
                return this.m_Discount;
            }
            set
            {
                this.m_Discount = value;
            }
        }

        [Category("Column"), DisplayName("District_ID")]
        public string District_ID
        {
            get
            {
                return this.m_District_ID;
            }
            set
            {
                this.m_District_ID = value;
            }
        }

        [Category("Column"), DisplayName("Email")]
        public string Email
        {
            get
            {
                return this.m_Email;
            }
            set
            {
                this.m_Email = value;
            }
        }

        [DisplayName("Employee_ID"), Category("Primary Key")]
        public string Employee_ID
        {
            get
            {
                return this.m_Employee_ID;
            }
            set
            {
                this.m_Employee_ID = value;
            }
        }

        [DisplayName("Employee_Name"), Category("Column")]
        public string Employee_Name
        {
            get
            {
                return this.m_Employee_Name;
            }
            set
            {
                this.m_Employee_Name = value;
            }
        }

        [Category("Column"), DisplayName("EmployeeType")]
        public int EmployeeType
        {
            get
            {
                return this.m_EmployeeType;
            }
            set
            {
                this.m_EmployeeType = value;
            }
        }

        [Category("Column"), DisplayName("Fax")]
        public string Fax
        {
            get
            {
                return this.m_Fax;
            }
            set
            {
                this.m_Fax = value;
            }
        }

        [Category("Column"), DisplayName("FirtName")]
        public string FirtName
        {
            get
            {
                return this.m_FirtName;
            }
            set
            {
                this.m_FirtName = value;
            }
        }

        [Category("Column"), DisplayName("H_Tel")]
        public string H_Tel
        {
            get
            {
                return this.m_H_Tel;
            }
            set
            {
                this.m_H_Tel = value;
            }
        }

        [Category("Column"), DisplayName("IsPublic")]
        public bool IsPublic
        {
            get
            {
                return this.m_IsPublic;
            }
            set
            {
                this.m_IsPublic = value;
            }
        }

        [DisplayName("JobTitle_ID"), Category("Column")]
        public string JobTitle_ID
        {
            get
            {
                return this.m_JobTitle_ID;
            }
            set
            {
                this.m_JobTitle_ID = value;
            }
        }

        [DisplayName("LastName"), Category("Column")]
        public string LastName
        {
            get
            {
                return this.m_LastName;
            }
            set
            {
                this.m_LastName = value;
            }
        }

        [Category("Column"), DisplayName("Manager_ID")]
        public string Manager_ID
        {
            get
            {
                return this.m_Manager_ID;
            }
            set
            {
                this.m_Manager_ID = value;
            }
        }

        [DisplayName("Married"), Category("Column")]
        public int Married
        {
            get
            {
                return this.m_Married;
            }
            set
            {
                this.m_Married = value;
            }
        }

        [DisplayName("Mobile"), Category("Column")]
        public string Mobile
        {
            get
            {
                return this.m_Mobile;
            }
            set
            {
                this.m_Mobile = value;
            }
        }

        [DisplayName("ModifiedBy"), Category("Column")]
        public string ModifiedBy
        {
            get
            {
                return this.m_ModifiedBy;
            }
            set
            {
                this.m_ModifiedBy = value;
            }
        }

        [DisplayName("ModifiedDate"), Category("Column")]
        public System.DateTime ModifiedDate
        {
            get
            {
                return this.m_ModifiedDate;
            }
            set
            {
                this.m_ModifiedDate = value;
            }
        }

        [Category("Column"), DisplayName("O_Tel")]
        public string O_Tel
        {
            get
            {
                return this.m_O_Tel;
            }
            set
            {
                this.m_O_Tel = value;
            }
        }

        [DisplayName("OwnerID"), Category("Column")]
        public string OwnerID
        {
            get
            {
                return this.m_OwnerID;
            }
            set
            {
                this.m_OwnerID = value;
            }
        }

        [Category("Column"), DisplayName("PersonalTax_ID")]
        public string PersonalTax_ID
        {
            get
            {
                return this.m_PersonalTax_ID;
            }
            set
            {
                this.m_PersonalTax_ID = value;
            }
        }

        [Category("Column"), DisplayName("Position_ID")]
        public string Position_ID
        {
            get
            {
                return this.m_Position_ID;
            }
            set
            {
                this.m_Position_ID = value;
            }
        }

        public string Product
        {
            get
            {
                return "Class EMPLOYEE";
            }
        }

        [DisplayName("ProfitRate"), Category("Column")]
        public decimal ProfitRate
        {
            get
            {
                return this.m_ProfitRate;
            }
            set
            {
                this.m_ProfitRate = value;
            }
        }

        [Category("Column"), DisplayName("Sex")]
        public bool Sex
        {
            get
            {
                return this.m_Sex;
            }
            set
            {
                this.m_Sex = value;
            }
        }

        [DisplayName("Sorted"), Category("Column")]
        public long Sorted
        {
            get
            {
                return this.m_Sorted;
            }
            set
            {
                this.m_Sorted = value;
            }
        }

        [Category("Column"), DisplayName("Team_ID")]
        public string Team_ID
        {
            get
            {
                return this.m_Team_ID;
            }
            set
            {
                this.m_Team_ID = value;
            }
        }
    }
}

